package com.example.controller.ActiveMQ;

import com.example.controller.BaseController;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Controller;

@Controller

public class ConsumerController extends BaseController {

    // 监听和读取queue消息
    @JmsListener(destination = "amq.queue")
    public void  readActiveMQQueue(String name){
        System.out.println("接收到queue的数据："+ name);
    }

    // 监听和读取topic消息
    @JmsListener(destination="amq.topic")
    public void readActiveTopic1(String name) {
        System.out.println("1接收到topic消息：" + name);
    }


    @JmsListener(destination="amq.topic")
    public void readActiveTopic2(String name) {
        System.out.println("2接收到topic消息：" + name);
    }
}
